home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / modula2 / 355 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.5 KB

  1. Path: yama.mcc.ac.uk!dmu!usenet
  2. From: Graham Perkins <grp@dmu.ac.uk>
  3. Newsgroups: comp.lang.modula2
  4. Subject: Re: An ISO Standard Question
  5. Date: Tue, 27 Feb 1996 19:11:08 +0000
  6. Organization: De Montfort University
  7. Message-ID: <3133574C.2962@dmu.ac.uk>
  8. References: <1996Feb27.135653.53493@ucl.ac.uk>
  9. NNTP-Posting-Host: mkcsst22.mk.dmu.ac.uk
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0 (Win16; I)
  14.  
  15. gstark@ifs.org.uk wrote:
  16. >.. one of two "ISO Compliant" compilers we've tested (XDS), this is legal:
  17. > VAR
  18. >   s : StrArr;
  19. > BEGIN
  20. >   s := StrArr{"Hello" , "Mum" };
  21. > ... but this is *illegal*:
  22. > TYPE
  23. >   Str = ARRAY[1 .. 10] OF CHAR;
  24. >   StrArr = ARRAY[1 .. 2] OF Str;
  25. > CONST
  26. >   s = StrArr{"Hello" , "Mum"};
  27. > However this structured constant *is* allowed under GPM2,
  28.  
  29. I've got Fourth Draft of the ISO standard, which I believe was quite close to
  30. the final.  It clearly states that the value given for a named constant in a 
  31. constant declaration must be a constant expression.  It is also states that an
  32. array constructor is a constant expression if its contents are constant expressions.
  33. My understanding of that is that one could construct arbitrarily nested array/record
  34. structures, so long as "leaf" items were constant values.
  35.  
  36. -- 
  37. person: Graham Perkins         paper: School of Computing
  38. voice:  +44 (0)1908 834936            De Montfort University
  39. dots:   +44 (0)1908 834948            Milton Keynes MK7 6HP
  40. bits:   grp@dmu.ac.uk                 United Kingdom
  41.